# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=bamf-framework
pkgver=35.30d2b4b
pkgrel=5
pkgdesc='A modular framework designed to be a platform to launch attacks against botnets.'
url='https://github.com/bwall/BAMF'
arch=('any')
license=('MIT')
groups=('blackarch' 'blackarch-malware' 'blackarch-defensive')
depends=('python2' 'python2-yara' 'yara' 'python2-simplejson' 'python2-pycurl'
        'python2-pygeoip')
makedepends=('git')
source=("$pkgname::git+https://github.com/bwall/BAMF.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin/"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE.TXT

  cp -a * "$pkgdir/usr/share/$pkgname/"

  chmod u+rwX,g+rwX,o+rX -R "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/bamfdetect" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 bamfdetect.py "\$@"
EOF

  cat > "$pkgdir/usr/bin/bamfbrute" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 bamfbrute.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/bamfbrute"
  chmod +x "$pkgdir/usr/bin/bamfdetect"
}

